package com.ptszyxx.popose.module.base.user;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.lifecycle.ViewModelProviders;

import com.ptszyxx.popose.BR;
import com.ptszyxx.popose.R;
import com.ptszyxx.popose.common.constants.BundleConstant;
import com.ptszyxx.popose.databinding.ActivityUserNickBinding;
import com.ptszyxx.popose.databinding.ActivityUserSexBinding;
import com.ptszyxx.popose.module.base.user.vm.UserNickVM;
import com.ptszyxx.popose.module.base.user.vm.UserSexVM;
import com.ysg.base.BaseFragment;
import com.ysg.http.data.AppViewModelFactory;

/**
 * 完善用户信息
 */
public class UserSexFragment extends BaseFragment<ActivityUserSexBinding, UserSexVM> {

    @Override
    public int initContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return R.layout.activity_user_sex;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public UserSexVM initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getActivity().getApplication());
        return ViewModelProviders.of(this, factory).get(UserSexVM.class);
    }

    @Override
    public void initParam() {
        super.initParam();
        Bundle bundle = getArguments();
        if (bundle != null){
            viewModel.birthday.set(bundle.getString(BundleConstant.USER_BIRTHDAY));
        }
    }
}